package com.bwie.controller;

import com.bwie.pojo.Goods;
import com.bwie.pojo.req.GoodsRequest;
import com.bwie.result.PageResult;
import com.bwie.result.Result;
import com.bwie.service.EsGoodsService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RequestMapping("/esGoods")
@RestController
@Log4j2
public class EsGoodsController {
    @Autowired
    private EsGoodsService esGoodsService;

    @PostMapping("/list")
    public Result<PageResult<Goods>> list(@RequestBody GoodsRequest goodsRequest){
        try {
            Thread.sleep(800);
            Result<PageResult<Goods>> result=esGoodsService.list(goodsRequest);
            return result;
        }catch (Exception e){
            e.printStackTrace();
        }
       return null;
    }
}
